home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 7
/
007.d81
/
dos #16
< prev
next >
Wrap
Text File
|
2022-08-26
|
2KB
|
108 lines
DOS AND DON'TS -- Part 16
{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}
To help clear up a few things about
the Block-Allocate command, here is
an example.
10 OPEN15,8,15 :REM ERROR/COMM
20 OPEN2,8,2,"#" :REM DATA BUFFER
30 :
40 FOR X = 1 to 10:REM WRITE TO BUFF
50 PRINT#2, "THIS IS DATA"
60 NEXT X
70 :
80 TR=10 : SE=15 :REM TRACK/SECTOR
90 :
100 PRINT#15,"B-A:"0;TR;SE
110 INPUT#15,ER,ER$,NT,NS
120 :
130 IF ER=65 THEN TR=NT:SE=NS:GOTO 100
140 :
150 PRINT"We can put the data at:"
160 PRINT"TRACK # :";TR
170 PRINT"SECTOR # :";SE
180 :
190 CLOSE2:CLOSE15
200 END
First of all, this program does NOT
write anything to the disk. All it
does is put data into the buffer and
FIND a place to put it. To actually
write data to the disk, we use the
USER - TWO command. The U2 command
tells the disk-drive to 'put all that
stuff in the buffer onto the disk
starting at TRACK xx , SECTOR yy'.
If we modify our above program, we
can get our data written to the disk.
10 OPEN15,8,15
20 OPEN2,8,2,"#"
30 :
40 FOR X = 1 TO 10
50 PRINT#2,"THIS IS DATA"
60 NEXT X
70 :
80 TR=10 : SE=15
90 :
100 PRINT#15,"B-A:"0;TR;SE
110 INPUT#15,ER,ER$,NT,NS
120 :
130 IF ER=65 THEN TR=NT:SE=NS:GOTO100
140 :
150 PRINT"WE CAN PUT THE DATA AT:"
160 PRINT"TRACK #";TR
170 PRINT"SECTOR #";SE
180 :
190 REM SO LET'S WRITE THE DATA
200 PRINT#15,"U2:"2;0;TR;SE
210 :
220 REM THIS WRITES THE DATA IN BUFFER
230 REM NUMBER 2, ONTO DRIVE 0,
240 REM AT TRACK 'TR' AND
250 REM SECTOR 'SE'.
260 :
270 CLOSE2:CLOSE15
280 END
Well, now we know how to get data
written to the disk by way of the
U2 command. One thing you should
notice is that whatever buffer we
put our data into (via PRINT#2 in line
50), is the buffer we want to tell
the U2 command to get the data from.
Hence there is a '2' in the line with
the U2 command.
------- continued in PART 17 ---------